package view.component.weapon
{
	import enums.main.UISize;
	
	import feathers.controls.Screen;
	import feathers.controls.ScrollText;
	
	import starling.animation.Tween;
	import starling.core.Starling;
	
	
	/**
	 * 武器其他使用数据界面
	 * @author £iang
	 * 
	 */	
	public class WeaponOtherInfoView extends Screen
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** 数据文本 */
		public var infoText:ScrollText;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 初始化函数 
		 * 
		 */		
		override protected function initialize():void
		{ 
			infoText = new ScrollText();
			infoText.isHTML = true;
			this.addChild( infoText );
		}
		
		/**
		 * 绘制函数 
		 * 
		 */		
		override protected function draw():void
		{
			infoText.width = UISize.MAIN_W - 20 * this.dpiScale;
			infoText.height = UISize.MAIN_H - 
				UISize.MONSTER_TAB_AREA_H * 2 * this.dpiScale;
			infoText.x = 10 * this.dpiScale;
		}
		
		/**
		 * 设置文本内容 
		 * @param info 内容
		 * 
		 */		
		public function setText( info:String ):void
		{
			infoText.text = info;	
		}
		
		/**
		 * 播放隐藏动画 
		 * 
		 */		
		public function playHideAnimation():void
		{
			var tween:Tween = new Tween( this, 0.4 );
			
			tween.animate( "alpha", 0);
			Starling.juggler.add( tween );
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		/**
		 * 析构函数 
		 * 
		 */		
		override public function dispose():void
		{
			Starling.juggler.removeTweens( this );
			infoText.dispose();
			infoText = null;
			super.dispose();
		}
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function WeaponOtherInfoView()
		{
			super();
		}
	}
}